const express = require('express');
const bodyparser = require('body-parser');
const fs = require('fs');
var server = express();

// 接受POST
server.use(bodyparser.urlencoded({'extended':false}))
// 监听接口 /LWAPI
server.use('/LWAPI',function (req,res) {
	// 获取请求数据
	console.log(req.body);
	// 返回数据
	retData = {
		'userId' : req.body['userId'],
		't' :10,
		'timer' : Date.now().toString()
	}
	console.log(retData);
	res.send(retData);
	res.end();
});

server.listen(8080);
console.log("server is OK");